package com.d5xx.hunters.events;

import com.d5xx.hunters.API.Hunter;
import com.d5xx.hunters.API.HunterPlayer;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDamageEvent;

public class PVPSwitch implements Listener {
    @EventHandler
    public void onPVPSwitch(EntityDamageEvent event) {
        if (event.getEntity() instanceof Player player) {
            HunterPlayer hunterPlayer = Hunter.getHunterPlayer(player);
            switch (hunterPlayer.getType()) {
                case "lobby":
                case "lobby-waiting":
                case "game-fall":
                case "death":
                    event.setCancelled(true);
            }
        }
    }
}
